import Vue from 'vue' //引入vue
import Vuex from 'vuex' //引入vuex
Vue.use(Vuex); //使用 vuex

//创建state
const state = {
    authorities: [] //用户权限信息
}

const mutations = {
    _setAuthorities: (state, msg) => {
        state.authorities = msg
    }
}

const actions = {
    setAuthorities: (context, msg) => {
        context.commit('_setAuthorities', msg)
    }
}

const getters = {
    getAuthorities: (state) => {
        return state.authorities
    }
}


export default new Vuex.Store({
    state,
    mutations,
    actions,
    getters
})